package com.medusa.aps.business.modules.plan.mp.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.medusa.aps.business.model.BaseEntity;
import com.medusa.aps.business.model.enums.SchedulingStatusEnum;
import com.medusa.aps.business.util.PercentageScheduleUtils;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 排产任务视图实体类
 *
 * @author yuxh
 * @since 2023-08-14 17:37:49
 */
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@Schema(description = "排产任务视图实体类")
public class SchedulingTaskView extends BaseEntity<SchedulingTaskView> {
    /**
     * 主键
     */
    @Schema(description = "主键Id")
    @TableId(type = IdType.AUTO)
    private Integer id;
    /**
     * 订单id
     */
    @Schema(description = "订单id")
    private Integer orderId;
    /**
     * 订单号
     */
    @Schema(description = "订单号")
    private String orderNumber;

    /**
     * 物料id
     */
    @Schema(description = "物料id")
    private Long materialId;

    /**
     * 物料编码
     */
    @Schema(description = "物料编码")
    private String itemNumber;
    /**
     * 物料名称
     */
    @Schema(description = "物料名称")
    private String itemName;
    /**
     * 需求数量
     */
    @Schema(description = "需求数量")
    private BigDecimal demandQuantity;
    /**
     * 计划数量
     */
    @Schema(description = "计划数量")
    private BigDecimal plannedQuantity;
    /**
     * 订单交期
     */
    @Schema(description = "订单交期")
    private LocalDate orderDeliveryTime;
    /**
     * 订单状态
     */
    @Schema(description = "订单状态")
    private SchedulingStatusEnum orderStatus;
    /**
     * 已排程数量
     */
    @Schema(description = "已排程数量")
    private BigDecimal scheduledQuantity;
    /**
     * 未排程数量
     */
    @Schema(description = "未排程数量")
    private BigDecimal unscheduledQuantity;
    /**
     * 已完工数量
     */
    @Schema(description = "已完工数量")
    private BigDecimal completedQuantity;
    /**
     * 未完工数量
     */
    @Schema(description = "未完工数量")
    private BigDecimal unfinishedQuantity;
    /**
     * 计划开始时间
     */
    @Schema(description = "计划开始时间")
    private LocalDateTime plannedStartTime;
    /**
     * 计划结束时间
     */
    @Schema(description = "计划结束时间")
    private LocalDateTime plannedEndTime;
    /**
     * 实际完工时间
     */
    @Schema(description = "实际完工时间")
    @TableField(updateStrategy = FieldStrategy.ALWAYS)
    private LocalDateTime actualCompletionTime;
    /**
     * 交期差异天数
     */
    @Schema(description = "交期差异天数")
    @TableField(updateStrategy = FieldStrategy.ALWAYS)
    private Integer deviationDays;
    /**
     * 订单进度
     */
    @Schema(description = "订单进度")
    private BigDecimal orderProgress;

    /**
     * 获取主键值
     *
     * @return 主键值
     */
    @Override
    public Serializable pkVal() {
        return this.id;
    }

}

